package com.swipemaster.activities;

import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;

import com.swipemaster.common.Global;

public class CommonActivity extends Activity
{
	@Override
	public void onBackPressed()
	{
		Global.app.musicPlayer.continueMusic = true;
		super.onBackPressed();
	}

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		getWindow().setFormat(PixelFormat.RGBA_8888);
	}

	@Override
	protected void onDestroy()
	{
		super.onDestroy();
	}

	@Override
	protected void onPause()
	{
		if (!Global.app.musicPlayer.continueMusic)
		{
			Global.app.musicPlayer.stopMusic();
		}

		super.onPause();
	}

	@Override
	protected void onResume()
	{
		if (Global.app.musicPlayer.continueMusic)
		{
			Global.app.musicPlayer.continueMusic = false;
		}
		else
		{
			Global.app.musicPlayer.playMainTheme();
		}

		super.onResume();
	}
}
